import { request } from "@/utils";
// 获取频道列表
export const getChannelAPI = () => {
  return request({
    method: 'get',
    url: '/channels'
  })
}   
//提交文章
export const creatArticleAPI = (data) => {
  return request({
    method: 'post',
    url:'/mp/articles?draft=false',
    data
  })
}   
//获取文章列表
export const getArticleListAPI = (params) => {
  return request({
    method: 'get',
    url:'/mp/articles',
    params
  })
}   
//删除文章
export const delArticleAPI = (id) => {
  return request({
    method: 'delete',
    url:`/mp/articles/${id}`
  })
}  
//获取文章详情 
export const getArticleById = (id) => {
  return request({
    method: 'get',
    url:`/mp/articles/${id}`
  })
}  

export const updateArticle = (data) => {
  return request({
    method: 'put',
    url:`/mp/articles/${data.id}?draft=false`,
    data
  })
}  